<!doctype html>
<html>
<head>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<title>我的</title>
<link href="../../css/newStyle.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../../js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../../js/common.js"></script>
<script type="text/javascript" src="../../js/gbRst.js"></script>
<script type="text/javascript" src="../../js/utils.js"></script>
<script type="text/javascript" src="../../js/openId.js"></script>
<script type="text/javascript" src="../../js/ajaxfileupload.js"></script> 
<script type="text/javascript" src="../../js/header&footer.js"></script>
<!-- <script type="text/javascript" src="../../js/carService.js"></script>
 --><script type="text/javascript" src="../../js/doubleDate2.0.js"></script>
<script type="text/javascript" src="../../js/check.js"></script>
<!-- <script type="text/javascript" src="../../js/ImageBrowsing.js"></script>
 -->		<script type="text/javascript" src="../../js/qmsk-1.2.js"></script>
		<script type="text/javascript" src="../../js/openId.js"></script>
		<script type="text/javascript" src="../../js/communityTheme.js"></script>
<script type="text/javascript">
var  memberId
var  ime
var imeFlag = false;
var isUser = false;
var userId = null;
$(function(){
	$(".workerColumn").hide()
	var user  = _findInfo("../../../user/find/findUserByOpenId",{'openId':_openId})
	if(IsNotEmpty(user)&&user.state==0){
		if(user.result.data.length>0){
			isUser = true;	
		userId = getHtmlString(getHeadIndexValue(0, user, "CustomerID"));
		$(".workerColumn").show()
		window.locat
		}
	}
	
	var  member=_findInfo("../../../member/find/shopId/"+getShopId()+"/openId/"+_openId, null)
	if(IsNotEmpty(member)&&member.state==0){
		if(member.result.data.length==0){
			getNameAndImage(_openId)
		}
		  memberId=getHtmlString(getHeadIndexValue(0, member, "memberId"));
		var memberName=getHtmlString(getHeadIndexValue(0, member, "CustomerName"));
	  ime=getHtmlString(getHeadIndexValue(0, member, "imageUrl"));
		if(IsEmpty(ime)){
			ime = "../../images/userImg.jpg";
			imeFlag = true;
		}
		$("#userImage").attr("src",ime);
		$("#memberName").html(memberName);
		$("#myLevel").html(getHtmlString(getHeadIndexValue(0, member, "LevelName")))
		
		getAdvisor(memberId)
		getMessageCount()
		
	}
})

function getMessageCount(){
	var count  = _findInfo("../../../customerMessage/find/messageCount", {'shopId':_shopId,'memberId':memberId})
	if(IsNotEmpty(count)&&count.state==0){
		if(count.result.data.length>0){
			$("#messageCount").html(getHtmlInt(getHeadIndexValue(0, count, "sdcount"))+" | "+getHtmlInt(getHeadIndexValue(0, count, "fscount")))
		}
	}
}



function getAdvisor(memberId){
	if(IsNotEmpty(memberId)){
		
	var dt = _findInfo("../../../myAdvisor/find/myAdvisor", {'opneId':_openId})
	if(IsNotEmpty(dt)&&dt.state==0){
		if(dt.result.data.length>0){
			for ( var i = 0; i < dt.result.data.length; i++) {
				
				var htm = "<dl class=\"shopInside askFor myHelp\"><dt><img src=\""+getHtmlString(getHeadIndexValue(i, dt, "userImageUrl"))+"\"></dt><dd><span class=\"replySir\" onClick=\"goLy("+getHtmlString(getHeadIndexValue(i, dt, "customerId"))+")\"></span><p>姓名：<span>"+getHtmlString(getHeadIndexValue(i, dt, "userName"))+"</span></p><p>岗位：<span>"+getHtmlString(getHeadIndexValue(i, dt, "typeName"))+"</span></p><p class=\"callPhone\"><span class=\"phone\"></span><a href=\"tel:"+getHtmlString(getHeadIndexValue(i, dt, "userMp"))+"\" class=\"green\">"+getHtmlString(getHeadIndexValue(i, dt, "userMp"))+"</a></p></dd></dl>"
				$("#myAdvisor").append(htm)
			}
		}
	}
	}
}

function goMyPost(){
	var htm = "?openId="+_openId+"&shopId="+_shopId
	redirectUrl("myPost.html"+htm)		
}
function goMyMessage(){
	var htm = "?openId="+_openId+"&shopId="+_shopId
	redirectUrl("myMessage.html"+htm)		
}
function goSubscribe(){
	var htm = "?openId="+_openId+"&shopId="+_shopId
	redirectUrl("Subscribe.html"+htm)		
}
function goMyCar(){
	var htm = "?openId="+_openId+"&shopId="+_shopId
	redirectUrl("myCar.html"+htm)		
}
function goRecommendRecord(){
	var htm = "?openId="+_openId+"&shopId="+_shopId
	redirectUrl("record.html"+htm)		
}
function goTryRecord(){
	var htm = "?openId="+_openId+"&shopId="+_shopId
	redirectUrl("tryDriverRecord.html"+htm)		
}
function goService(){
	var htm = "?openId="+_openId+"&shopId="+_shopId
	redirectUrl("serviceRecord.html"+htm)		
}
function goInsurance(){
	var htm = "?openId="+_openId+"&shopId="+_shopId
	redirectUrl("insuranceRecord.html"+htm)		
}
function goReAsserss(){
	var htm = "?openId="+_openId+"&shopId="+_shopId
	redirectUrl("reAsserssRecord.html"+htm)		
}

function goWokerTryRecord(){
	var htm = "?openId="+_openId+"&shopId="+_shopId+"&userId="+userId
	redirectUrl("workerTryDriver.html"+htm)		
}
function goWokerService(){
	var htm = "?openId="+_openId+"&shopId="+_shopId+"&userId="+userId
	redirectUrl("wokerServiceRecord.html"+htm)		
}
function goWokerInsurance(){
	var htm = "?openId="+_openId+"&shopId="+_shopId+"&userId="+userId
	redirectUrl("wokerInsuranceRecord.html"+htm)		
}
function goWokerReAsserss(){
	var htm = "?openId="+_openId+"&shopId="+_shopId+"&userId="+userId
	redirectUrl("wokerReAsserssRecord.html"+htm)		
}

function goComplaint(){
	var htm = "?openId="+_openId+"&shopId="+_shopId
	redirectUrl("advise.html"+htm)		
}

function goLy(id){
	var htm = "?openId="+_openId+"&shopId="+_shopId+"&userId="+id+"&memberId="+memberId
	redirectUrl("replySir.html"+htm)	
}
function goComeOver(id){
	var htm = "?openId="+_openId+"&shopId="+_shopId+"&userId="+id+"&memberId="+memberId
	redirectUrl("comeOver.html"+htm)	
}
function updateUserImage(){
	if(imeFlag&&IsNotEmpty(memberId)){
		var dt = _editInfo("../../../cust/edit/updateImageUrlByOpenId", {'openId':_openId});
		if(dt.state==0){
			var m = getHtmlString(getHeadIndexValue(0, dt, "imageUrl"));
			if(IsEmpty(m)){
				m=ime
			}
			$("#userImage").attr("src",m)
		}
	}
}

function getNameAndImage(_openId){
	var dt = _findInfoPost("../../../cust/find/findImageUrlByOpenId", {'openId':_openId});
	if(dt.state==0){
		var m = getHtmlString(getHeadIndexValue(0, dt, "imageUrl"));
		var name = getHtmlString(getHeadIndexValue(0, dt, "name"));
		if(IsEmpty(m)){
			m=ime
		}
		$("#userImage").attr("src",m)
		$("#memberName").html(name)
	}
}

</script>		
</head>

<body class="bgShade">
<div class="wrapper">
  <div class="placeTit"><a class="back" onClick="goComeOver()"></a>我的</div>
  <header class="comeAward" style="height:62px;">
    <div class="userImg"><img id="userImage" src="../../images/userImg.jpg" onclick="updateUserImage()"></div>
    <h4 id="memberName"><span class="nickname"></span></h4>
    <div class="level" id="myLevel"></div>
  </header>
  <div class="container">
  	<section class="module" id="myAdvisor">
    	<h2 class="xilie"><span>我的顾问</span></h2>
    	<!-- <dl class="shopInside askFor">
        	<dt><img src="../../images/userImg.jpg"></dt>
            <dd><span class="replySir" onClick="goLy()"></span><p>姓名：<span>张海龙</span></p><p>岗位：<span>销售顾问</span></p><p class="callPhone"><span class="phone"></span><a href="tel:0107474510" class="green">0107474510</a></p></dd>
        </dl>
    	<dl class="shopInside askFor">
        	<dt><img src="../../images/userImg.jpg"></dt>
            <dd><span class="replySir" onClick="redirectUrl('replySir.html')"></span><p>姓名：<span>张海龙</span></p><p>岗位：<span>服务顾问</span></p><p class="callPhone"><span class="phone"></span><a href="tel:0107474510" class="green">0107474510</a></p></dd>
        </dl>
    	<dl class="shopInside askFor">
        	<dt><img src="../../images/userImg.jpg"></dt>
            <dd><span class="replySir" onClick="redirectUrl('replySir.html')"></span><p>姓名：<span>张海龙</span></p><p>岗位：<span>客户经理</span></p><p class="callPhone"><span class="phone"></span><a href="tel:0107474510" class="green">0107474510</a></p></dd>
        </dl> -->
    </section>
  	<section class="module">
    	<ul>
<!--         	<li onClick="goMyCar()">我的车辆<span class="go"></span></li>
 -->        	<li onClick="goSubscribe()">我的订阅<span class="go"></span></li>
        	<li onClick="goMyMessage()">我的消息（<span class="red" id="messageCount">0</span>）<span class="go"></span></li>
        	<li onClick="goMyPost()">我的帖子<span class="go"></span></li>
        </ul>
    </section>
  	<section class="module">
    	<ul>
        	<li onclick="goRecommendRecord()">我的推荐记录<span class="go"></span></li>
        	<li onclick ="goTryRecord()" >试驾预约记录<span class="go"></span></li>
        	<li class="workerColumn" onClick="goWokerTryRecord()">试驾预约消息（<span class="red">0</span>）<span class="go"></span></li>
        	<li onclick = "goService()">维修预约记录<span class="go"></span></li>
        	<li class="workerColumn" onClick="goWokerService()">维修预约消息（<span class="red">0</span>）<span class="go"></span></li>
        	<li onclick = "goInsurance()">保险预约记录<span class="go"></span></li>
        	<li class="workerColumn" onClick="goWokerInsurance()">保险预约消息（<span class="red">0</span>）<span class="go"></span></li>
        	<li onclick = "goReAsserss()">二手车预约/评估记录<span class="go"></span></li>
        	<li class="workerColumn" onClick="goWokerReAsserss()">二手车预约/评估消息（<span class="red">0</span>）<span class="go"></span></li>
<!--         	<li onclick = "goService()">救援记录<span class="go"></span></li>
 -->        </ul>
    </section>
  	<section class="module">
    	<ul>
        	<li onclick="goComplaint()">投诉建议<span class="go"></span></li>
        </ul>
    </section>
  </div>
</div>
</body>
</html>
